package service;

import dao.UserDao;
import model.User;

import javax.sound.midi.Soundbank;

public class UserManage {
    public static void main(String[] args) {
        System.out.println("mmm");
    }

    private UserDao userDao = new UserDao();

    //验证用户名和密码
    public boolean checkUser(String username, String password) {
        boolean flag = false;
        User user = userDao.getUserByName();
        if (user != null && user.getUsername().equals(password)) {
            flag = true;


        }
        return false;
    }

    //添加新用户
    public void registUser(User user) {

        if (userDao.getUserByName(user.getUsername()) != null) {
            return;
        }
        if (userDao.addUser(user)) {
            System.out.println("注册成功");
        } else {
            System.out.println("注册失败");
        }

    }


}
